www.mxdraw.com
内容索引主面
前一个向上下一个
IMxDrawUtility::GetEntity 方法

与用户交互到在图面上选择一个实体

IDL
[helpstring("method GetEntity")]
HRESULT GetEntity([out] IMxDrawPoint** pPickPoint, [in] BSTR prompt, [out,retval] IMxDrawEntity** ppEntity);
参数 
说明 
[out] IMxDrawPoint** pPickPoint 
返回实体的选择点 
[in] BSTR prompt 
选择实体时的提示字符串 

返回选择到的实体对象

例如: VC6代码

        void CTestVc2005Dlg::DoDrawOrder()
        {
            // 选择实体。
            MxDrawXLib::IMxDrawUtilityPtr mxUtility;
            mxUtility.CreateInstance(__uuidof( MxDrawXLib::MxDrawUtility ));
            if(mxUtility == NULL)
            {
                return;
            }

            // _bstr_t sPrompt(_T("请选择实体"));
            CComPtr<IMxDrawPoint> spPickPoint;
            IMxDrawEntityPtr spEntity = mxUtility->GetEntity(&spPickPoint,_T("请选择实体"));

            if(spEntity == NULL)
                return;

            // 把实体设置成,最下面去。
            m_ocx.SetEntityDrawOrder(spEntity->GetObjectID(),-100);
            long lOrder = m_ocx.GetEntityDrawOrder(spEntity->GetObjectID());
            m_ocx.UpdateDisplay();
        }

例如: VB代码

       Set mxUtility = New MxDrawXLib.MxDrawUtility
       Dim getPt As MxDrawXLib.MxDrawPoint
       Set ent = mxUtility.GetEntity(getPt, Chr(13) + Chr(10) + "选择读取扩展数据的实体:")

       If (ent Is Nothing) Then
            MsgBox "没有选择实体.."
            Exit Sub
       End If

       Dim xData As MxDrawXLib.MxDrawResbuf


       Set xData = ent.GetXData("")

       If (xData.Count = 0) Then
            MsgBox "没有扩展数据"
       Else
            xData.PrintData
       End If
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!